import { ILoadMapTypeAll } from '@/common';
import { getLevelZeroJson, getSelectDataCommon, getTenantID } from '@/utils';
import { AssetacquisitionManageAPI } from '../common/type';
/**
 * @param {Object} loadMdicMapList 数据字典
 * @param {Object} areaListData 地区字典
 * */
const ManageSearchColumns = (loadMdicMapList: Record<string, any>, queryTypeObj: Record<string, any>): AssetacquisitionManageAPI.IHeaderSearchType => {
  /**申请状态数据字典*/
  const applyStatusList = getSelectDataCommon(loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.STORAGE_TRANS_STATUS}`], 'name', 'id');

  const searchColumns: AssetacquisitionManageAPI.ISearchList = [
    {
      name: 'applyTitle',
      placeholder: '事项名称',
      label: '事项名称',
      componentType: 'Input',
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'name',
      searchParams: {
        fieldType: 'String',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: 'allotType',
      placeholder: '交接类型',
      label: '交接类型',
      componentType: 'Select',
      dataSource: [
        {
          value: 1,
          name: '在用资产交接(部门内)',
        },
        {
          value: 2,
          name: '在用资产调剂(跨部门)',
        },
        {
          value: 3,
          name: '闲置资产调剂(跨部门)',
        },
      ],
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: 'state',
      placeholder: '状态',
      label: '状态',
      componentType: 'Select',
      dataSource: applyStatusList,
      allowClear: true,
      md: 5,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'String',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: 'createTime',
      placeholder: '申请',
      label: '申请',
      componentType: 'RangePicker',
      allowClear: true,
      md: 9,
      sm: 24,
      whetherSenior: false,
      searchParams: {
        fieldType: 'Date',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    /**===============================高级搜素================================*/
    {
      name: 'createFormName',
      placeholder: '申请',
      label: '申请',
      componentType: 'DeptAndUser',
      dataSource: getLevelZeroJson() ?? [],
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'createCompanyID',
        DEPT: 'createDepartmentID',
        POS: 'createPositionID',
        USER: 'createrID',
      },
    },
    // {
    //   name: 'checkState',
    //   placeholder: '审批状态',
    //   label: '审批状态',
    //   componentType: 'Select',
    //   dataSource: approveStatusList,
    //   allowClear: true,
    //   md: 4,
    //   sm: 24,
    //   whetherSenior: true,
    //   searchParams: {
    //     fieldType: 'String',
    //     fieldParam: 0,
    //     fieldUse: 0,
    //     searchType: 0,
    //     seq: 0,
    //   },
    // },
    {
      name: 'cancelTime',
      placeholder: '',
      label: '作废时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
      searchParams: {
        fieldType: 'Date',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
    {
      name: 'cancelFormName',
      placeholder: '作废',
      label: '作废',
      componentType: 'DeptAndUser',
      dataSource: getLevelZeroJson() ?? [],
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'cancelCompanyID',
        DEPT: 'cancelDepartmentID',
        POS: 'cancelPositionID',
        USER: 'cancelerID',
      },
      searchParams: {
        fieldType: 'String',
        fieldParam: 0,
        fieldUse: 0,
        searchType: 0,
        seq: 0,
      },
    },
  ];

  return searchColumns;
};

export { ManageSearchColumns };
